﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace Etapa1.ModelDescription
{
    public class SubdivideModel : Modelo
    {
        public SubdivideModel(List<VertexPositionNormalTexture> listaVertices, List<int> indices)
            : base(listaVertices, indices)
        {
        }

        public void Subdivide()
        {
            //            for( int i=0; i<this.edges; i++ )
            //            {
            //            int val0 = m_pEList[i].m_v[0]->Valence();
            //            int val1 = m_pEList[i].m_v[1]->Valence();
            //            point3 loc;
            //            /**
            //            * CASE 1: both vertices are of valence == 6
            //            * Use the butterfly scheme
            //            */
            //            if( val0 == 6 && val1 == 6 )
            //            {
            //            loc = m_pEList[i].CalcButterfly();
            //            }
            //            /**
            //            * CASE 2: one of the vertices are of valence == 6
            //            * Calculate the k-vertex for the non-6 vertex
            //            */
            //            else if( val0 == 6 && val1 != 6 )
            //            {
            //            loc = m_pEList[i].CalcKVert(1,0);
            //            }
            //            else if( val0 != 6 && val1 == 6 )
            //            {
            //            loc = m_pEList[i].CalcKVert(0,1);
            //            }
            //            /**
            //            * CASE 3: neither of the vertices are of valence == 6
            //            * Calculate the k-vertex for each of them, and average
            //            Chapter 8: Advanced 3D Techniques  395
            //            * the result
            //            */
            //            else
            //            {
            //            loc = ( m_pEList[i].CalcKVert(1,0) +
            //            m_pEList[i].CalcKVert(0,1) ) / 2.f;
            //            }
            //            cGraphicsLayer::cDefaultVertex tempVertex;
            //            tempVertex.m_vPosition = *(D3DXVECTOR3*)&loc;
            //            tempVertex.m_vNormal = D3DXVECTOR3(0,0,0);
            //            tempVertex.m_vColor = D3DXCOLOR(0,0,0,0);
            //            tempVertex.m_TexCoords = D3DXVECTOR2(0,0);
            //            m_pEList[i].m_newVLoc.m_vert = tempVertex;
            //            /**
            //            * Assign the new vertex an index. (This is useful later,
            //            * when we start throwing vertex pointers around. We
            //            * could have implemented everything with indices, but
            //            * the code would be much harder to read. An extra dword
            //            * per vertex is a small price to pay.)
            //            */
            //            m_pEList[i].m_newVLoc.m_index = i + m_nVerts;
            //}
            //        }
        }
    }
}
